      <!-- banner start -->
      <div class="banner">
            <div class="banner-title">
                <h2><?=$moudle_name ?></h2>
                <!-- <p><code>table.table</code> / 将它放在卡片的主容器<code>.card-body</code>里面</p> -->
            </div>
            <div class="banner-action">  
                <!-- form start -->
                <form class="form" action="<?php echo base_url();?>/admin/auto_trade/index" method="get">   
                    <fieldset class="form-group">
                        <input class="input" type="text" placeholder="交易方式" name="trade_way" value="<?=$search['trade_way']; ?>">
                    </fieldset>
                    <fieldset class="form-group">
                        <!-- <legend class="label">日期选择</legend> -->
                        <label class="input-addon">
                            <input type="text" class="input" action="date" id="date-1" lay-key="1" placeholder="日期选择" name="create_time" value="<?=$search['create_time']; ?>">
                            <span class="addon"><i class="icon-calendar"></i></span>
                        </label>
                    </fieldset>
                    <button type="submit" class="button">搜索</button>
                    <a href="<?php echo site_url().'admin/auto_trade/edit'; ?>" class="button button-green button-collapse">新增</a>
                </form>
                <!-- form over -->
            </div>
        </div>
        <!-- banner over -->
        <!-- container start -->
        <div class="container-fluid">
            <!-- row start -->
            <div class="row">
                <!-- column start -->
                <div class="col-12">
                    <section class="card">
                        <div class="card-header">
                            <h3 class="title"><?=$table_name ?></h3>
                            <!-- <div class="card-header-action">
                                <fieldset class="form-group">
                                    <input class="input" type="text" placeholder="交易方式">
                                </fieldset>
                                <button type="button" class="button button-small">搜索</button>
                                <a href="<?php echo site_url().'admin/auto_trade/edit'; ?>" class="button button-small  button-green button-collapse">新增</a>
                                <button type="button" class="button button-small button-green button-collapse">新增</button>
                            </div> -->
                        </div>
                        <div class="card-table">
                            <!-- table start -->
                            <table class="table table-responsive">
                                <thead>
                                    <tr>
                                        <th align="left">编号</th>
                                        <th align="left">
                                            <fieldset class="form-group">
                                                <label class="radiocheckbox-item">
                                                    <input class="radiocheckbox checkAll" type="checkbox" action="checkall" hidden>
                                                    <span class="radiocheckbox-replace"></span>
                                                </label>
                                            </fieldset>
                                        </th>
                                        <th align="left">账户1</th>
                                        <th align="left">账户2</th>
                                        <th align="left">交易方式</th>
                                        <th align="left">交易次数</th>
                                        <th align="left">创建时间</th>
                                        <th align="right">相关操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php foreach ($list as $item):
									?>
                                    <tr>
                                        <td align="left">
                                        <!-- <?php echo site_url().'admin/orders/index?trade_id='; ?><?=$item['id']?>  data-toggle="modal" data-target="#demo-1"-->
                                            <a href="#" onclick="ordersmodal('<?php echo $item['id'];?>');">#<?php echo $item['id'];?></a>
                                        </td>
                                        <td align="center">
                                            <fieldset class="form-group">
                                                <label class="radiocheckbox-item">
                                                    <input onclick="clickOne()" class="radiocheckbox checkOne" type="checkbox" name="checkIds" value="<?php echo $item['id'];?>" id="<?php echo $item['id'];?>" hidden>
                                                    <span class="radiocheckbox-replace"></span>
                                                </label>
                                            </fieldset>
                                        </td>
                                   
                                        <td>
                                            <p class="gray"><?php echo $item['account1'];?></p>
                                        </td>
                                        <td>
                                            <p class="gray"><?php echo $item['account2'];?></p>
                                        </td>
                                        <td><span class="label label-blue"><?php echo $item['trade_way'];?></span></td>
                                        <td><?php echo $item['trade_num'];?></td>
                                        <td><?php echo $item['create_time'];?></td>
                                        <td align="right">
                                            <!-- <a href="<?php echo site_url().'admin/auto_trade/edit/'; ?><?=$item['id']?>" class="button button-small">编辑</a> -->
                                            <a href="#" class="button button-small button-red" onclick="deleteOne('<?php echo $item['id'];?>');">删除</a>                                            
                                        </td>
                                    </tr>
                                    <?php endforeach;?>

                                </tbody>
                            </table>
                            <!-- table over -->
                        </div>
                        <div class="card-footer">
                            <div class="button-group">
                                <!-- <button type="button" class="button" id='allcheck'>全选</button> -->
                                <button type="button" class="button button-red" id="deleteIds">删除</button>
                            </div>
                            <div class="button-group-pagination">
                                <span class="info">共<?php echo $total_num;  ?>条数据</span>
                                <?php echo $pages;?>
                                <!-- <span>上一页</span>
                                <span class="active">1</span>
                                <a href="#">2</a>
                                <a href="#">3</a>
                                <a href="#">4</a>
                                <a href="#">5</a>
                                <span>...</span>
                                <a href="#">99</a>
                                <a href="#">下一页</a> -->
                            </div>
                            <!-- pagination over -->
                        </div>
                    </section>
                </div>
                <!-- column over -->
            </div>
            <!-- row over -->
            
        </div>
        <!-- container over -->
        <div class="modal fade" id="demo-1">
            <div class="modal-dialog">
                <!-- card start -->
                <section class="card">
                    <div class="card-header">
                        <h3 class="title">交易详情<small>订单列表</small></h3>
                        <div class="card-header-action">
                            <button type="button" class="button button-flat" data-dismiss="modal"><i class="icon-cancel"></i></button>
                        </div>
                    </div>
                    <div class="card-table">
                        <!-- table start -->
                        <table class="table table-responsive">
                                <thead>
                                    <tr>
                                        <th align="left">订单编号</th>
                                        <th align="left">账户名</th>
                                        <th align="left">订单类型</th>
                                        <th align="left">订单方法</th>
                                        <th align="left">金额</th>
                                        <th align="left">数量</th>
                                    </tr>
                                </thead>
                                <tbody id="orders">
                                    
                                </tbody>
                            </table>
                            <!-- table over -->
                    </div>
                    <div class="card-footer">
                        <div class="button-group">
                            <!-- <button type="button" class="button" data-dismiss="modal">确定</button> -->
                            <button type="button" class="button button-red" data-dismiss="modal">关闭</button>
                        </div>
                    </div>
                </section>
                <!-- card over -->
            </div>
        </div>
        <div class="modal fade" id="demo-2">
            <div class="modal-dialog modal-small">
                <!-- card start -->
                <section class="card">
                    <div class="card-header">
                        <h4 class="title">删除数据<small></small></h4>
                    </div>
                    <div class="card-body">
                        <p>确定要删除选中数据嘛？</p>
                    </div>
                    <div class="card-footer">
                        <button type="button" class="button button-small" id="deleteAll">确定</button>
                        <button type="button" class="button button-small button-flat" data-dismiss="modal">关闭</button>
                    </div>
                </section>
                <!-- card over -->
            </div>
        </div>
        <div class="modal fade" id="demo-3">
            <div class="modal-dialog modal-small">
                <!-- card start -->
                <section class="card">
                    <div class="card-header">
                        <h4 class="title">删除数据<small></small></h4>
                    </div>
                    <div class="card-body">
                        <p>请选择要删除的数据！</p>
                    </div>
                    <div class="card-footer">
                        <button type="button" class="button button-small" data-dismiss="modal">确定</button>
                        <button type="button" class="button button-small button-flat" data-dismiss="modal">关闭</button>
                    </div>
                </section>
                <!-- card over -->
            </div>
        </div>
        <!-- modal over -->
        <!-- page script start -->
        <script type="text/javascript">
        jQuery(document).ready(function($) {
            // 全选
            $('[action="checkall"]').on('click', function() {
                if (this.checked) {
                    $('tbody [type="checkbox"]').prop('checked', true);
                } else {
                    $('tbody [type="checkbox"]').prop('checked', false);
                }
            });
            // 日期选择
            laydate.render({
                elem: '#date-1',
                format: 'yyyy-MM-dd',
                showBottom: false
            });
            // 时间选择
            laydate.render({
                elem: '#date-2',
                type: 'time'
            });
            // 范围选择
            laydate.render({
                elem: '#date-3',
                format: 'yyyy-MM-dd',
                range: true
            });
            // 代码块
            Prism.highlightAll();
        });
        $("#deleteIds").click(function(){
            var checkIds='';
            $.each($('input:checkbox'),function(){
                if(this.checked){
                    if($(this).val()!="on"){
                        checkIds=checkIds+$(this).val()+",";
                    }
                }
            });
            if(checkIds==""){
                $("#demo-3").modal("show");
            }else{
                $("#demo-2").modal("show");
            }
        });
        function clickOne(){
            var allChecked = true;
            $(".checkOne").each(function(){
                if($(this).prop("checked") == false){
                    allChecked = false;
                };
            });
            if(allChecked){
                $(".checkAll").prop("checked",true);
            } else {
                $(".checkAll").prop("checked",false);
            }
        }
        $("#deleteAll").click(function(){
            var checkIds='';
            $.each($('input:checkbox'),function(){
                if(this.checked){
                    if($(this).val()!="on"){
                        checkIds=checkIds+$(this).val()+",";
                    }
                }
            });
            //alert(checkIds);
            window.location.href="<?php echo site_url().'admin/auto_trade/delete?checkIds='; ?>"+checkIds;
        });
        function deleteOne(id){
            $("#demo-2").modal("show");
            $("#"+id).attr("checked", "checked");
        };
        $("#allcheck").click(function(){
            $(":checkbox").each(function () {
                if ($(this).attr("checked") == "checked") {
                    $(this).removeAttr("checked");
                }
                else {
                    $(this).attr("checked", "checked");
                }
            });
        });
       
        function ordersmodal(id){
            var html='';
            $.ajax({
                type : "GET",
                url :"<?php echo site_url();?>admin/auto_trade/orders",
                data:{ trade_id: id,
                },
                success : function(data) {
                    for (var i=0;i<JSON.parse(data).list.length;i++)
                    {
                        html+="<tr>";
                        html+="    <td>";
                        html+="        "+JSON.parse(data).list[i].order_id+"";
                        html+="    </td>";
                        html+="    <td>";
                        html+="        <p class=’gray'>"+JSON.parse(data).list[i].account+"</p>";
                        html+="    </td>";
                        html+="    <td>";
                        html+="        <span class='label label-blue'>"+JSON.parse(data).list[i].market+"</span>";
                        html+="    </td>";
                        html+="    <td>";
                        html+="        <span class='label label-green'>"+JSON.parse(data).list[i].side+"</span>";
                        html+="    </td>";
                        html+="    <td>"+JSON.parse(data).list[i].price+"</td>";  
                        html+="    <td>"+JSON.parse(data).list[i].volume+"</td>";                                    
                        html+="</tr>";
                    }
                    $("#orders").html(html);
                    $("#demo-1").modal("show");
                }
            });
            
        };
        </script>
        <!-- page script over -->